{extend name="extra@admin/content"}
{block name="content"}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称</label>
        <div class="layui-input-block">
            <input name="goods_name" readonly="readonly" value='{$goods.name}'
                   required="required" title="商品名称" placeholder="商品名称" class="layui-input ">
        </div>
    </div>
    {if condition="!empty($goods.is_spec)"}
    <div class="layui-form-item">
        <label class="layui-form-label">商品属性</label>
        <div class="layui-input-block">
            <select name="goods_spec_id" lay-verify="" lay-search>
                {volist name='goods_spec' id='v'}
                <option value="{$v.id}">{$v.title}</option>
                {/volist}
            </select>
        </div>
    </div>
    {/if}
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
          <input type="radio" lay-filter="test" name="sign" value="1"  title="进货" >
          <input type="radio" lay-filter="test" name="sign" value="3"  title="报损" >
        </div>
    </div>

    <div class="layui-form-item" id="del_num">
        <label class="layui-form-label">应变数</label>
        <div class="layui-input-block">
            <input name="del_num" value=''
                   required="required" title="应变数" placeholder="请输入应变数" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item" id="rec_num">
        <label class="layui-form-label">实变数</label>
        <div class="layui-input-block">
            <input name="rec_num" value=''
                   required="required" title="实变数" placeholder="请输入实变数" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item" id="dif_num" style="display:none">
        <label class="layui-form-label">报损数</label>
        <div class="layui-input-block">
            <input name="dif_num" value=''
                   required="required" title="报损数" placeholder="请输入报损数" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入备注，最多100个字符" maxlength="100" title="请输入备注" class="layui-textarea" name="remark"></textarea>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <input type='hidden' value='{$goods_id}' name='goods_id'/>
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>  
    <script>window.form.render();</script>
    <script>
    form.on('radio(test)', function(data){
        if(data.value == 1){
            $('#del_num').show();
            $('#rec_num').show();
            $('#dif_num').hide();
        }else{
            $('#del_num').hide();
            $('#rec_num').hide();
            $('#dif_num').show();
        }
        
    });
    </script> 
</form>
{/block}